/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package presentation.view;

/**
 *
 * @author Joanna 8a
 */
public class PanelVerContactos extends javax.swing.JPanel {

    /**
     * Creates new form PanelVerContactos
     * @param opc 1: ver contactos, 2: Modificar Contactos, 3: Eliminar Contacto
     */
    public PanelVerContactos(int opc) {
        initComponents();
        if (opc==1){
        jButtonModCont.setVisible(false);
        jButtonElimCont.setVisible(false);
        }else if(opc==2){
        jButtonElimCont.setVisible(false);
        }else if (opc==3){
        jButtonModCont.setVisible(false);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane2 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jButtonVolverVerCont = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTableVerContactos = new javax.swing.JTable();
        jButtonModCont = new javax.swing.JButton();
        jButtonElimCont = new javax.swing.JButton();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane2.setViewportView(jTable1);

        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Contactos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI Light", 1, 14), new java.awt.Color(0, 102, 102))); // NOI18N

        jButtonVolverVerCont.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
        jButtonVolverVerCont.setText("Volver");

        jTableVerContactos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null}
            },
            new String [] {
                "Nombre", "Apellidos", "Teléfonos", "E-mail"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(jTableVerContactos);

        jButtonModCont.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
        jButtonModCont.setText("Modificar Contacto");
        jButtonModCont.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonModContActionPerformed(evt);
            }
        });

        jButtonElimCont.setFont(new java.awt.Font("Segoe UI Light", 0, 14)); // NOI18N
        jButtonElimCont.setText("Eliminar Contacto");
        jButtonElimCont.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonElimContActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 453, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 1, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jButtonModCont)
                        .addGap(27, 27, 27)
                        .addComponent(jButtonElimCont)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButtonVolverVerCont)
                        .addGap(32, 32, 32))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 399, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonVolverVerCont)
                    .addComponent(jButtonModCont)
                    .addComponent(jButtonElimCont)))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonModContActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModContActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        PanelModificarContacto modCont=new PanelModificarContacto(2);
        modCont.setVisible(true);
    }//GEN-LAST:event_jButtonModContActionPerformed

    private void jButtonElimContActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonElimContActionPerformed
        // TODO add your handling code here:
        //1= Para panel eliminar contacto.
        this.setVisible(false);
        PanelModificarContacto modCont=new PanelModificarContacto(1);
        modCont.setVisible(true);
    }//GEN-LAST:event_jButtonElimContActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonElimCont;
    private javax.swing.JButton jButtonModCont;
    private javax.swing.JButton jButtonVolverVerCont;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTableVerContactos;
    // End of variables declaration//GEN-END:variables
}
